import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import keter.util.IOUtil;

public class Palindrome {
    static List<String> pList = new ArrayList<String>();

    public static void judge(String s) { // 判断字符串是否为回文
        if (s != null) {
            StringBuffer sbuff = new StringBuffer(s);
            String rs = sbuff.reverse().toString();// 倒序一个字符串
            if (s.equals(rs)) {
                System.out.println(s);
                pList.add(s);
                // System.out.print(s.charAt(2));
            }
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = IOUtil.getBufferedReader("d:\\temp\\p.txt");
        String str1 = "";
        while (str1 != null) {
            str1 = br.readLine();
            if(str1==null)
                    continue;
            for (int j = 0; j < str1.length() - 5; j++) {
                String ss = str1.substring(j, j + 5);
                judge(ss);
            }
        }
        System.out.println("==========");
        for (int i = 1; i < pList.size(); i++) {
            if (pList.get(i).toString().charAt(0) == pList.get(i - 1).toString().charAt(0)) {
                System.out.println(pList.get(i-1));
                System.out.println(pList.get(i));
            }
        }

    }
}
